/*
 * img_processing.h
 *
 *  Created on: 2021年3月24日
 *      Author: Jiarun
 */

#ifndef CODE_IMG_PROCESSING_H_
#define CODE_IMG_PROCESSING_H_


#include "SEEKFREE_MT9V03X.h"
#include "tracking_control.h"


#define  USEH  60//(MT9V03X_H / 2)
#define  USEW  94//(MT9V03X_W / 2)


#define START_LINE  25
#define OFFSET      8u
#define JUMP_LIMIT  5u   //判断黑线是否有效斜率判断差值


extern unsigned char Image_Use[USEH][USEW], Bin_Image[USEH][USEW];
extern uint8 crossroad_flag, stop_mark, Y_row, seek_finish_flag, outlimit;

extern int8 brim_L[USEH], brim_R[USEH], wide[USEH], center[USEH];//, Deal_flag[USEH]
extern sint16 bias;
extern uint8 valid_rowL, valid_rowR, val_row, row_cnt, distan_flg, junction, junction_cnt;

void Get_Bin_Image (unsigned char mode);
void Get_Use_Image(void);
void Bin_Image_Filter (void);
void Seek_Road (void);
void seek_side(void);
void keystone_correction(uint8 start,uint8 end);
uint8 jump_limit(void);
void line_smoothen(uint8 num);
uint32 abs_sub(uint32 diff1,uint32 diff2);
uint8 brim_L_is_straight(uint8 start_row, uint8 end_row, uint8 cnt);
uint8 brim_R_is_straight(uint8 start_row, uint8 end_row, uint8 cnt);

#endif /* CODE_IMG_PROCESSING_H_ */
